class Solution(object):
    def compareVersion(self, version1, version2):
        """
        :type version1: str
        :type version2: str
        :rtype: int
        """
        vn1 = version1.split('.')
        vn2 = version2.split('.')
        for i in range(max(len(vn1), len(vn2))):
            num1 = int(vn1[i]) if i < len(vn1) else 0
            num2 = int(vn2[i]) if i < len(vn2) else 0
            if num1 > num2:
                return 1
            elif num1 < num2:
                return -1
        return 0